import http from '../util/request.js'

export default {
    captcha:()=>{
        return http({
            url: '/api/login/captcha',
            method: 'get',
        });
    },
    add:(obj)=>{
        return http({
            url: '/api/login/add',
            method: 'post',
            data: obj,
            headers: {
                //定义将数据以json的形式传入后台(java)
                'Content-Type': 'application/json'
            }
        });
    },
    login:(obj)=>{
        return http({
            url: '/api/login/dologin',
            method: 'post',
            //表单参数
            params: obj
        });
    },
    logininfo:(obj)=>{
        return http({
            url: '/api/login/logininfo',
            method: 'get',
        });
    },

    resetPassword: (obj)=>{
        return http({
            url: '/api/login/rest',
            method: 'put',
            data: obj,
            headers: {
                //定义将数据以json的形式传入后台(java)
                'Content-Type': 'application/json'
            }
        });
    },
    // 新增发送验证码接口
    sendCode: (email)=>{
        return http({
            url: '/api/login/sendResetCode',
            method: 'post',
            data: { email }
        });
    },
    // 新增邮箱重置密码接口
    resetByEmail: (obj)=>{
        return http({
            url: '/api/login/resetByEmail',
            method: 'post',
            data: obj,
            headers: {
                'Content-Type': 'application/json'
            }
        });
    },

    updateUser:(obj)=>{
        return http({
            url: '/api/user/updateUserById',
            method: 'put',
            data: obj,
            headers: {
                //定义将数据以json的形式传入后台(java)
                'Content-Type': 'application/json'
            }
        });
    },

}